ocsp: bind responder authorization to CertID issuerKeyHash#10303
ocsp: bind responder authorization to CertID issuerKeyHash#10303julek-wolfssl wants to merge 3 commits intowolfSSL:masterfrom
Conversation
Addresses ZD21675
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens OCSP responder authorization by binding delegated responder checks to the OCSP CertID issuerKeyHash (in addition to issuerNameHash), addressing ZD21675.
Changes:
- Store issuer key hash on
Signerand propagate it from parsed certificates. - Extend
CheckOcspResponder(and chain-check helper) to requireissuerKeyHashmatches for delegated responders. - Adjust OCSP verification call sites to pass the extra key-hash context.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| wolfssl/wolfcrypt/asn.h | Adds issuerKeyHash to Signer for OCSP authorization binding. |
| wolfssl/ocsp.h | Updates CheckOcspResponder signature to include subject/issuer key hashes. |
| wolfcrypt/src/asn.c | Populates issuerKeyHash and updates OCSP responder checks to pass new params. |
| src/ocsp.c | Enforces name+key matching (CertID halves) for delegated OCSP responders and chain building. |
Comments suppressed due to low confidence (1)
wolfcrypt/src/asn.c:1
OcspRespCheck()currently passesresponder->subjectKeyHashas the first argument toCheckOcspResponder, but that parameter is compared againstsingle->issuerHash(the CertID issuer name hash). This makes the issuer check compare a key-hash to a name-hash and will incorrectly fail/behave. Passresponder->subjectNameHashassubjectHashandresponder->subjectKeyHashassubjectKeyHash.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
| #endif | ||
| #ifdef HAVE_OCSP | ||
| byte subjectKeyHash[KEYID_SIZE]; | ||
| byte issuerKeyHash[KEYID_SIZE]; /* key hash of verifying parent CA */ |
There was a problem hiding this comment.
is this the issuer of the cert we are verifying? is this the root CA of the chain whose leaf certificate we are verifying?
There was a problem hiding this comment.
Clarified comment.
- Use KEYID_SIZE for Signer key-hash comparisons since
Signer.{subject,issuer}KeyHash is sized KEYID_SIZE, not OCSP_DIGEST_SIZE.
- Rename subjectHash/issuerHash to subjectNameHash/issuerNameHash in
CheckOcspResponder/CheckOcspResponderChain to make the name-vs-key
hash distinction explicit.
- Expand the Signer.issuerKeyHash field comment to clarify it is the
subject key hash of the immediate issuer CA.
- Add an imposter-root-ca cert (same DN as root-ca, different RSA key)
for tests that need to exercise the new CertID issuerKeyHash binding.
Adds resp_certid_keyhash_mismatch — a forged response signed by the legitimate ocsp-responder whose CertID pairs the legitimate root CA's issuerNameHash with the imposter root CA's issuerKeyHash. The new test_ocsp_responder_keyhash_binding asserts wolfSSL_OCSP_basic_verify rejects it, exercising the fix that requires both halves of the CertID to match the responder's issuer.
|
Testing added |
|
Failures are not related to the PR. |
Addresses ZD21675